<include file="public@header"/>
</head>
<body>
<div class="layui-fluid js-check-wrap">
    <form class="form-search" method="" action="{:url('Route/index')}">
        <!-- 每页数量 -->
        <input type="hidden" name="page_size" value="{$filter.page_size}">
    </form>

    <div class="layui-card">
        <form class="js-ajax-form" action="{:url('route/listOrder')}" method="post">
            <div class="layui-card-header well">
                <div class="layui-col-xs6">
                    <h2>{:lang('ADMIN_ROUTE_INDEX')}</h2>
                </div>

                <div class="layui-col-xs6 text-right">
                    <!-- 添加分类 -->
                    <a href="{:url('route/add')}" class="layui-btn layui-btn-normal">{:lang('ADMIN_ROUTE_ADD')}</a>
                    <!-- 保存顺序 -->
                    <button type="submit" class="layui-btn layui-btn-warm js-ajax-submit">{:lang('SAVE_SORT')}</button>
                </div>
            </div>
            
            <div class="layui-card-body">
                <table class="layui-table">
                    <thead>
                    <tr>
                        <th width="50">排序</th>
                        <th width="50">ID</th>
                        <th>原始网址</th>
                        <th>显示网址</th>
                        <th>类型</th>
                        <th>状态</th>
                        <th width="145">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <php>
                        $statuses=array('0'=>"已禁用","1"=>"已启用");
                        $types=array('1'=>"自定义","2"=>"别名定义");
                    </php>
                    <foreach name="routes" item="vo">
                        <tr>
                            <td>
                                <eq name="vo.type" value="2">
                                    <input class="input-order" type="text" value="{$vo.list_order}" readonly>
                                    <else/>
                                    <input name="list_orders[{$vo.id}]" class="input-order" type="text"
                                           value="{$vo.list_order}">
                                </eq>

                            </td>
                            <td>{$vo.id}</td>
                            <td>{$vo.full_url}</td>
                            <td>{$vo.url}</td>
                            <td>
                                <eq name="vo.type" value="2">
                                    <span class="layui-btn layui-btn-danger layui-btn-xs" data-toggle="tooltip" title="别名定义规则,无法编辑,排序">{$types[$vo['type']]}</span>
                                    <else/>
                                    <span class="layui-btn layui-btn-normal layui-btn-xs" data-toggle="tooltip" title="自定义规则,可以编辑,排序">{$types[$vo['type']]}</span>
                                </eq>
                            </td>
                            <td>{$statuses[$vo['status']]}</td>
                            <td>
                                <eq name="vo.type" value="2">
                                    <button class="layui-btn layui-btn-disabled layui-btn-xs">编辑</button>
                                    <button class="layui-btn layui-btn-disabled layui-btn-xs">禁用</button>
                                    <button class="layui-btn layui-btn-disabled layui-btn-xs">启用</button>
                                    <else/>
                                    <a class="layui-btn layui-btn-xs" href="{:url('route/edit',array('id'=>$vo['id']))}">编辑</a>
                                    <eq name="vo.status" value="1">
                                        <a href="{:url('route/ban',array('id'=>$vo['id']))}" class="js-ajax-dialog-btn layui-btn layui-btn-warm layui-btn-xs"
                                           data-msg="确定禁用吗？">禁用</a>
                                        <else/>
                                        <a href="{:url('route/ban',array('id'=>$vo['id'],'cancel'=>1))}" class="js-ajax-dialog-btn layui-btn layui-btn-normal layui-btn-xs"
                                           data-msg="确定启用吗？">启用</a>
                                    </eq>
                                    <a href="{:url('route/delete',array('id'=>$vo['id']))}" class="js-ajax-delete layui-btn layui-btn-danger layui-btn-xs">删除</a>
                                </eq>
                            </td>
                        </tr>
                    </foreach>
                    </tbody>
                </table>
            </div>

            <!-- <div class="pagination-row clearfix">
                <div class="layui-col-sm6 text-left-sm">
                    <div class="btn-group dropup marginTB-xs">
                        <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                            显示条数 <span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu" role="menu">
                            <li><a href="javascript:setPageSize(10);">10</a></li>
                            <li><a href="javascript:setPageSize(20);">20</a></li>
                            <li><a href="javascript:setPageSize(30);">30</a></li>
                            <li><a href="javascript:setPageSize(50);">50</a></li>
                            <li><a href="javascript:setPageSize(80);">80</a></li>
                            <li><a href="javascript:setPageSize(100);">100</a></li>
                        </ul>
                    </div>

                    <button type="submit" class="layui-btn layui-btn-primary js-ajax-submit">{:lang('SAVE_SORT')}</button>
                </div>

                <div class="pages">{$page|default=''}</div>
            </div> -->
        </form>
    </div>
</div>
<include file="public@footer"/>
